#ifndef ENROLL_H
#define ENROLL_H

#include <QWidget>
#include <QTcpSocket>

namespace Ui {
class Enroll;
}

class Client;  // 前向声明

class Enroll : public QWidget
{
    Q_OBJECT

public:
    explicit Enroll(Client *client,QWidget *parent = nullptr);
    ~Enroll();

protected:
    // 用于拖动窗口的事件处理函数
    void mousePressEvent(QMouseEvent *event) override;
    void mouseMoveEvent(QMouseEvent *event) override;

    void paintEvent(QPaintEvent *event) override;

private slots:
    void on_returnButton_clicked();

    void onReadyRead();  // 处理接收到的数据

    void on_yes_clicked();

    void on_no_clicked();

private:
    Ui::Enroll *ui;
    Client *clientWindow;
    QTcpSocket *socket;  // TCP socket

    void sendDataToServer();  // 发送数据到服务端
    void handleServerResponse(const QString &response);  // 处理服务器返回信息

    // 用于记录拖动时鼠标位置的成员变量
    QPoint m_dragPosition;

    // 添加用于判断是否点击标题栏的成员变量
    bool m_isTitleBarClicked = false;
};

#endif // ENROLL_H
